﻿<phone:PhoneApplicationPage 
    x:Class="ContactsSample.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

	<shell:SystemTray.ProgressIndicator>
		<shell:ProgressIndicator x:Name="indicator" IsVisible="{Binding ShowProgress}"  IsIndeterminate="true" />
	</shell:SystemTray.ProgressIndicator>
	
    <Grid x:Name="LayoutRoot" Background="Transparent">
		<phone:Pivot Name="pivot" Title="Xamarin Mobile API Preview Contacts Sample">
			<phone:PivotItem Header="contacts">
				<ListBox Grid.Row="1" ItemsSource="{Binding Contacts}"  SelectedItem="{Binding Contact,Mode=TwoWay}">
					<ListBox.ItemTemplate>
						<DataTemplate>
							<TextBlock Text="{Binding DisplayName}" />
						</DataTemplate>
					</ListBox.ItemTemplate>
				</ListBox>
			</phone:PivotItem>

			<phone:PivotItem Header="details">
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition Height="80" />
						<RowDefinition Height="30" />
						<RowDefinition />
						<RowDefinition Height="30" />
						<RowDefinition />
					</Grid.RowDefinitions>
					
					<Grid Grid.Row="0">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="80*" />
							<ColumnDefinition Width="20*" />
						</Grid.ColumnDefinitions>

						<TextBlock Grid.Column="0" Text="{Binding Contact.DisplayName}" />
						<Image Grid.Column="1" Source="{Binding Thumbnail}" />
					</Grid>
					
					<TextBlock Grid.Row="1">Phones:</TextBlock>
					<ListBox Grid.Row="2" ItemsSource="{Binding Contact.Phones}">
						<ListBox.ItemTemplate>
							<DataTemplate>
								<StackPanel>
									<TextBlock Text="{Binding Label}" />
									<TextBlock Text="{Binding Number}" />
								</StackPanel>
							</DataTemplate>
						</ListBox.ItemTemplate>
					</ListBox>

					<TextBlock Grid.Row="3">Emails:</TextBlock>
					<ListBox Grid.Row="4" ItemsSource="{Binding Contact.Emails}">
						<ListBox.ItemTemplate>
							<DataTemplate>
								<StackPanel>
									<TextBlock Text="{Binding Label}" />
									<TextBlock Text="{Binding Address}" />
								</StackPanel>
							</DataTemplate>
						</ListBox.ItemTemplate>
					</ListBox>
				</Grid>
			</phone:PivotItem>
		</phone:Pivot>
	</Grid>
</phone:PhoneApplicationPage>